package com.digitalchina.lxnsy.adapter;

import android.content.Context;
import android.view.ViewGroup;

import com.digitalchina.lxnsy.interfaces.IRecyclerType;
import com.digitalchina.lxnsy.viewholder.ExpertTypeHolder;
import com.digitalchina.lxnsy.viewholder.UserTypeHolder;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.adapter
 * 创建人：byd
 * 创建时间：2017/4/7 17:42
 * 修改备注：
 * ================================================
 */

public class AdHistoryAdapter extends RecyclerArrayAdapter<IRecyclerType> {

    public static final int ITEM_TYPE_USER = 1;
    public static final int ITEM_TYPE_EXPERT = 2;

    public AdHistoryAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {

        if (viewType == ITEM_TYPE_USER)
            return new UserTypeHolder(parent);
        else
            return new ExpertTypeHolder(parent);

    }

    @Override
    public int getViewType(int position) {
        if (0 == position)
            return ITEM_TYPE_USER;
        else
            return getItem(position).type();
    }
}
